package com.bawei.module_login.re

import android.util.Log
import com.bawei.lib_common.repo.BaseRepositor
import com.bawei.module_login.api.LoginApiServer
import com.bawei.module_login.entriy.LoginEntriy
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class LoginRepository @Inject constructor(private val apiserver:LoginApiServer): BaseRepositor<LoginApiServer>() {
    suspend fun getAuthorId(username:String,password:String): Flow<LoginEntriy?> {
        return flow {
            val result=apiserver.getLogin(username,password)
            if(result.code==200){
                emit(result.data)
            }else{
                emit(null)
                Log.d("TAG", "getAuthorId: 登陆成功")
            }
        }
    }



}